{include file="public/head" /}
<div class="layui-fluid" style="top: 1rem;">
    <div class="layui-row">
        <form class="layui-form">
            <input type="hidden" id="id" name="id" required="" value="{$admin.id?$admin.id:''}"
                   lay-verify="id" autocomplete="off" class="layui-input">
            <div class="layui-form-item">
                <label for="nav" class="layui-form-label">
                    <span class="x-red">*</span>菜单名称</label>
                <div class="layui-input-inline">
                    <input type="text" id="nav" name="nav" required="" lay-verify="nav" autocomplete="off" class="layui-input" value="{$admin.nav?$admin.nav:''}"></div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>后台左边菜单名称
                </div>
            </div>

            <div class="layui-form-item">
                <label for="nav_url" class="layui-form-label">菜单链接</label>
                <div class="layui-input-inline">
                    <input type="text" id="nav_url" name="nav_url" required="" lay-verify="nav_url" autocomplete="off" class="layui-input" value="{$admin.nav_url?$admin.nav_url:''}"></div>
                <div class="layui-form-mid layui-word-aux">
                    后台左边菜单链接,添加(add),编辑(edit),删除(del),批量删除(delAll),启/禁用(isUse)
                </div>
            </div>

            <div class="layui-form-item">
                <label for="nid" class="layui-form-label">主菜单ID</label>
                <div class="layui-input-inline">
                    <input type="text" id="nid" name="nid" required="" lay-verify="nid" autocomplete="off" class="layui-input" value="{$admin.nid?$admin.nid:'0'}"></div>
                <div class="layui-form-mid layui-word-aux">
                    <span class="x-red">*</span>主菜单ID,上级id
                </div>
            </div>

            <div class="layui-form-item">
                <label for="sort" class="layui-form-label">菜单排序</label>
                <div class="layui-input-inline">
                    <input type="text" id="sort" name="sort" required="" lay-verify="sort" autocomplete="off" class="layui-input" value="{$admin.sort?$admin.sort:''}"></div>
                <div class="layui-form-mid layui-word-aux">
                    菜单排序
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">启用状态</label>
                <div class="layui-input-block">

                    <input type="radio" name="status" value="1" lay-skin="primary" title="开启" {if !empty($admin)} {if condition="$admin.status eq '1'"}checked="checked" {/if}{else}checked="checked"{/if}>
                    <input type="radio" name="status" value="0" lay-skin="primary" title="停用" {if !empty($admin)} {if condition="$admin.status eq '0'"}checked="checked" {/if}{/if}>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <button class="layui-btn" lay-filter="update" lay-submit="">保存</button></div>
        </form>
    </div>
</div>
</body>
<script>layui.use(['form', 'layer','jquery'],
    function() {
        $ = layui.jquery;
        var form = layui.form,
            layer = layui.layer;

        //监听提交
        form.on('submit(update)',
            function(data) {
                $.ajax({
                    type: "POST",
                    url: "{:getUrl()}Nav/update",
                    data: data.field,
                    dataType: "json",
                    success: function(data){
                        if(data.code ==200) {
                            layer.msg(data.msg, {icon: 6},function(){
                                //关闭当前frame
                                xadmin.close();
                                parent.location.reload();
                            });
                        } else {
                            layer.msg(data.msg,{icon: 5,time:1000});
                        }
                    }
                });
                return false;
            });

    });</script>
</html>